package com.gonsin.gview.model.table;

import cn.hutool.core.bean.BeanUtil;
import com.gonsin.gview.model.i18n.TCloneable;
import com.gonsin.i18n.logic.T;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.rmi.MarshalledObject;

@Data
@ApiModel("枚举描述")
public class GEnumsModel implements TCloneable<GEnumsModel> {

    @ApiModelProperty("等于什么值的时候显示该枚举")
    private String value;

    @ApiModelProperty("枚举显示方式，参考EnumsType")
    private String type;

    @ApiModelProperty("值等于该枚举时，显示该文本")
    private String text;

    @ApiModelProperty("type = icon时有效，图标位置")
    private String iconUrl;

    @ApiModelProperty("type = icon时有效，图标大小，格式为   ${width}x${height}，单位像素")
    private String iconSize;

    @Override
    public GEnumsModel tClone() {
        GEnumsModel model = new GEnumsModel();
        BeanUtil.copyProperties(this, model);
        if(text != null){
            model.text = T.t(text);
        }
        return model;
    }
}
